<!DOCTYPE html>
<html>
<head>
    {include file="common/meta" /}
    <style>

        .CommonMain {
             padding: 0 !important;
        }
    </style>
</head>

<body>

<main class="content">
    <div class="SearchBox am-cf">
        <div class="SearchInput am-fl">
            <form action="">
                <input type="text" name="keyword" value="{:input('keyword')}" placeholder="请输入您想查看的商户"/>
            </form>
        </div>
        <div class="SearchBtn am-fl">
            <a href="{:url('/')}">取消</a>
        </div>
    </div>

{if input('keyword')}
    <div class="SearchTips" style="display: none;">
        <img src="/map/images/warning.png" alt="提示警告"/>
        <span>目前没有搜索您想要的商家，给您推荐以下商家</span>
    </div>
{/if}
    <div class="CommonMain">

        <div class="CollectList">
        
        </div>

    </div>

</main>
<!--{include file="common/foot" /}-->
{include file="common/script" /}

</body>

</html>

{if input('keyword')}

<script type="text/javascript" src="__CDN__/assets/js/zepto.min.js"></script>
<script type="text/javascript" src="__CDN__/assets/js/PullToRefresh.min.js"></script>
<script>

    var n=1,flag=true;

    var refreshBox=new PullToRefresh({
        container:".CommonMain",

        up:{
            callback:function(){

                setTimeout(function(){
                    n++
                    re_ajax(n)
                    refreshBox.endUpLoading(flag)

                },1000)
            }
        }
    })
    var keyword = "{:input('keyword')}";
    re_ajax(1,keyword);

    function re_ajax(page,keyword){
        $.ajax({
            type:"GET",
            url:"{:url('shop/shoplist_ajax')}",
            dataType:"json",
            data:{
                page:page,
                keysword:keyword

            },
            success:function(html){

                if(html=='0'){
                    flag=false;
                    if(keyword) {
                        $('.loadingBox').html(' ');
                    }else{
                        $('.loadingBox').html('没有更多数据了');
                    }
                    if(keyword) $('.SearchTips').show();
                    if(keyword) re_ajax(1,'');
                }else{
                    $('.CollectList').append(html);
                }
            },
            error:function(jqXHR){
                flag=false;
            }
        });
    }


</script>

{/if}
